<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/assets/view/base/tag.jsp" %>
<!DOCTYPE html>
<head>
    <title>mrcode</title>
    <jsp:include page="/assets/view/common/head-meta.jsp"/>
    <jsp:include page="/assets/view/common/head-ui.jsp"/>
    <%-- <link rel="stylesheet" href="/assets/lib/bootstrap/css/bootstrap.css">--%>
</head>
<body>
<jsp:include page="/assets/view/common/header.jsp"/>
<div class="container">

    <div class="mb-20">
        <%-- <span class="btn btn-mod btn-gray btn-round  icon-reorder"> 菜单 <i class=" icon-chevron-right"></i></span>--%>
        <a class="btn btn-mod btn-gray btn-round icon-bell-alt" role="button" data-toggle="collapse" href="#collapseExample"
           aria-expanded="false" aria-controls="collapseExample">
            今日通告
        </a>
    </div>

    <div class="collapse" id="collapseExample">
        <div class="jumbotron">
            <h1>Hello, ${user.name}</h1>
            <p>该页部分功能开发中。。。</p>
        </div>
    </div>
    <a class="btn btn-mod btn-medium btn-round width-pct-100" href="/auth/article/create_pre">
        写文章
    </a>
    <jsp:include page="menu.jsp"/>

    <ul class="nav nav-tabs nav-justified">
        <li id="statu1" role="presentation"><a href="/auth/manage/postlist/1"><span class="vertical-align-middle icon-certificate"> 正&nbsp;&nbsp;&nbsp;&nbsp;常<span
                class="icon-eye-open postlist-text-gray"></span></span></a></li>
        <li id="statu0" role="presentation"><a href="/auth/manage/postlist/0">
            <span class="vertical-align-middle icon-user-md">
                审核中<span class="icon-eye-close postlist-text-gray"></span>
            </span></a></li>
        <li id="statu2" role="presentation"><a href="/auth/manage/postlist/2"><span class="vertical-align-middle icon-edit"> 草稿箱<span
                class="icon-eye-close postlist-text-gray"></span></span></a></li>
        <li id="statu3" role="presentation"><a href="/auth/manage/postlist/3"><span class="vertical-align-middle icon-trash"> 回收站<span
                class="icon-eye-close postlist-text-gray"></span></span></a></li>
        <li id="statu4" role="presentation"><a href="/auth/manage/postlist/4"><span class="vertical-align-middle icon-warning-sign"> 异&nbsp;&nbsp;&nbsp;常<span
                class="icon-eye-close postlist-text-gray"></span></span></a></li>
    </ul>
    <div class="manager-table table-responsive">
        <table class="table table-striped table-hover" id="postTab">
            <tr>
                <th>标题</th>
                <th>阅读</th>
                <th>状态</th>
                <c:if test="${statu != 1 && statu != 2}">
                    <th>备注</th>
                </c:if>
                <th>操作</th>
            </tr>
            <c:choose>
                <c:when test="${not empty articlePage.results}">
                    <c:forEach items="${articlePage.results }" var="article" varStatus="index">
                        <tr>
                            <td><a href="/${article.userAccount}/article/details/${article.id}.html" target="_blank">${article.title}</a>
                            </td>
                            <td> ${article.readNum}</td>
                            <td>${article.statusName}</td>
                            <c:if test="${statu != 1 && statu != 2}">
                                <td>
                                    <c:if test="${article.statusRemark != null}">
                                        <span class="icon-comment"></span>
                                        <input type="hidden" value="${article.statusRemark}">
                                    </c:if>
                                </td>
                            </c:if>
                            <td>
                                <c:choose>
                                    <c:when test="${article.status == 1}">
                                        <a href="javascript:;" onclick="del_article_tips(this,'${article.id}','${article.status}','3')"
                                           class="btn btn-mod btn-round btn-w icon-trash">删除</a>
                                        <a href="/auth/article/edit_pre/${article.id}" target="_blank"
                                           class="btn btn-mod btn-round btn-w icon-edit">编辑</a>
                                        <a href="javascript:;" class="btn btn-mod btn-round btn-w icon-tags"
                                           tabindex="0" role="button"
                                           data-mc-category
                                           data-artId="${article.id}">分类</a>
                                    </c:when>
                                    <c:when test="${article.status == 3}">
                                        <a href="javascript:;" onclick="recovery(this,'${article.id}')"
                                           class="btn btn-mod btn-round btn-w icon-reply">恢复</a>
                                        <a href="/auth/article/edit_pre/${article.id}" target="_blank"
                                           class="btn btn-mod btn-round btn-w icon-edit">编辑</a>
                                        <a href="javascript:;" onclick="del_article_tips(this,'${article.id}','${article.status}','-1')"
                                           class="btn btn-mod btn-round btn-color icon-minus">删除</a>
                                    </c:when>
                                    <c:otherwise>

                                    </c:otherwise>
                                </c:choose>


                            </td>
                        </tr>
                    </c:forEach>
                </c:when>
                <c:otherwise>
                    <c:if test="${statu == 1}">
                        <tr>
                            <td colspan="5">
                                <a class="btn btn-mod btn-medium btn-round width-pct-100" href="/auth/article/create_pre">
                                    您还没有文章，快去写一篇吧
                                </a>
                            </td>
                        </tr>
                    </c:if>
                </c:otherwise>
            </c:choose>

        </table>
        <nav fenye="bootstrap" style="text-align: center">
            ${articlePage.getBootstrapHtml(6)}
        </nav>
        <form id="listFrom" action="" method="post">
            <input type="hidden" id="hi_pageNo" name="pageNo">
            <input type="hidden" id="hi_statu" name="statu" value="${statu}">
        </form>
    </div>
</div>

<jsp:include page="/assets/view/common/footer.jsp"/>
<script src="${contextPath}/assets/lib/jquery.validate.js"></script>
<script src="${contextPath}/assets/js/mangaerComm.js"></script>
<script src="/assets/js/fenye.js"></script>
<script src="/assets/js/postlist.js"></script>
<script>
    Postlist.Depot.cats=${categorys};
    $.each(Postlist.Depot.cats, function (i, catA) {
        Postlist.Depot.catsMap[catA.id] = catA;
    });
    $('#postTab a[data-mc-category]').popover({
        container: "body",
        toggle: "popover",
        placement: "left",
        trigger: "click",
        html:true,
        content: Postlist.category_ui(${categorys}),
        title: "所有分类列表"
    });
    Postlist.Init.postList();
</script>
</body>
</html>
